package com.osgix.common.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.transaction.annotation.Transactional;

import com.osgix.common.orm.ibatis.EntityDao;

@Transactional
public interface BaseManager<T, PK extends Serializable> {

	public abstract EntityDao<T, PK> getEntityDao();

	public T getById(PK id) throws DataAccessException;

	public List<T> findAll() throws DataAccessException;

	/** 根据id检查是否插入或是更新数据 */
	public void saveOrUpdate(T entity) throws DataAccessException;

	/** 插入数据 */
	public void save(T entity) throws DataAccessException;

	public void removeById(PK id) throws DataAccessException;

	public void update(T entity) throws DataAccessException;

}
